//1、编写 router/index.js文件
import { createMemoryHistory, createRouter } from 'vue-router'
import Login from "@/components/Login.vue"
import Home from "@/components/Home.vue";
import Favorites from "@/components/Favorites.vue";
import Cart from "@/components/Cart.vue";
import MyCenter from "@/components/MyCenter.vue";
import Reviews from "@/components/Reviews.vue";
import Address from "@/components/Address.vue";
import MyDetail from "@/components/MyDetail.vue";
import Register from "@/components/Register.vue";
import MyOrder from "@/components/MyOrder.vue";
import Appointment from "@/components/Appointment.vue";
import Order from "@/components/Order.vue";
import Order2 from "@/components/Order.vue";
import CarDetails from "@/components/CarDetails.vue";
import Store from "@/components/Store.vue";
import Store2 from "@/components/Store.vue";
import GoodsCart from "@/components/GoodsCart.vue";
import GoodsCart2 from "@/components/GoodsCart.vue";
import Settlement from "@/components/Settlement.vue";
import Reservation from "@/components/Reservation.vue";
import RatingForm from "@/components/RatingForm.vue";
import StoreApp from "@/components/StoreApp.vue";
import Configure from "@/components/Configure.vue";
import ConfigureNext from "@/components/ConfigureNext.vue";
import CarOrder from "@/components/CarOrder.vue";
import BuySettlement from "@/components/BuySettlement.vue";

//2、配置路由表信息
const routes = [
    {
        path: '/',
        name: 'home',
        component: Home
    }, {
        path: '/login',
        name: 'login',
        component: Login
    }, {
        path: '/favorites',
        name: 'favorites',
        component: Favorites
    }, {
        path: '/register',
        name: 'register',
        component: Register
    },{
        path: '/cart',
        name: 'cart',
        component: Cart
    },{
        path: '/reviews',
        name: 'reviews',
        component: Reviews
    },{　　　　//父子路径
        path: '/myCenter',
        name: 'myCenter',
        component: MyCenter,
        children: [
            {
                path: 'address',
                name: 'address',
                component: Address
            },
            {
                path: '',
                name: 'myDetail',
                component: MyDetail
            }
        ]
    },{　　　
        path: '/myOrder',
        name: 'myOrder',
        component: MyOrder,
        children: [
            {
                path: '',
                name: 'order',
                component: Order
            },
            {
                path: 'appointment',
                name: 'appointment',
                component: Appointment
            },
            {
                path: 'carOrder',
                name: 'carOrder',
                component: CarOrder
            },
        ]
    },{
        path: '/carDetails/:id',
        name: 'carDetails',
        component: CarDetails
    }, {
        path: '/store',
        name: 'store',
        component: Store
    }, {
        path: '/goodsCart',
        name: 'goodsCart',
        component: GoodsCart
    },{
        path: '/settlement',
        name: 'settlement',
        component: Settlement
    },{
        path: '/reservation/:id',
        name: 'reservation',
        component: Reservation
    },{
        path: '/ratingForm/:id',
        name: 'ratingForm',
        component: RatingForm
    },{
        path: '/storeApp',
        name: 'storeApp',
        component: StoreApp,
        children: [
            {
                path: '/order2',
                name: 'order2',
                component: Order2
            }, {
                path: '',
                name: 'store2',
                component: Store2
            },{
                path: '/goodsCart2',
                name: 'goodsCart2',
                component: GoodsCart2
            },
        ]
    },{
        path: '/configure/:id',
        name: 'configure',
        component: Configure
    },{
        path: '/configureNext',
        name: 'configureNext',
        component: ConfigureNext
    },{
        path: '/buySettlement',
        name: 'buySettlement',
        component: BuySettlement
    },

]

//创建路由器
const router = createRouter({
    history: createMemoryHistory(),
    routes,
})
export { router }